package com.sh.data.engine.domain.shims.sql.insert;

import com.sh.data.engine.domain.shims.sql.Context;
import com.sh.data.engine.domain.shims.sql.TerminalExpression;

import java.sql.SQLException;

/**
 * @Author: zigui.zdf @Date: 2022/1/25 10:31:00 @Description:
 */
public class InsertSql implements TerminalExpression {

    private Context context;

    public InsertSql(Context context, String sql) {
        this.context = context;
        this.context.append(sql);
    }

    public InsertSql values(Object... values) {
        context.addParameters(values);
        return this;
    }

    @Override
    public String toString() {
        return context.toString();
    }

    @Override
    public void execute() throws SQLException {
        context.execute();
    }
}
